package com.funong.matrix.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author wanjialin
 * @version 1.0
 * @date 2023/5/24
 */

@Getter
@AllArgsConstructor
public enum UserSexEnum {

    MAN(1, "男"),
    GIRL(2, "女");

    private Integer value;
    private String desc;

    public static UserSexEnum valueOf(Integer value) {
        return Arrays.stream(values())
                .filter(userSexEnum -> Objects.equals(value, userSexEnum.desc))
                .findFirst()
                .orElse(MAN);
    }
}
